<template>
  <div class="UserList">
    <h1>This is an UserList page</h1>
  </div>
  <div>
      <div v-for="(item, index) in info" :key="index">
        {{item.userName}} -- {{mapStatus(item.status)}} -- {{item.createDateStr}}-- {{item.modifyDateStr}}
      </div>
  </div>
</template>
<script>
import axios from "axios"

export default {
  data () {
    return {
      info: null //用来装返回的数组数据
    }
  },
  methods: {
    fetchData(){
      axios.get('http://localhost:8081/user/getAllUsers').then(res => {
        this.info = res.data.data
      })
    },
    mapStatus(org_value){
      if(org_value === '1'){
        return "有效";
      }else if(org_value === '2'){
        return "挂起";
      }else {
        return "无效";
      }
    }
  },
  mounted(){
    this.fetchData();
  }
}

</script>
